﻿using PLC.Application.Variables.Services;
using PLC.Interface.Variables;
using System.Threading.Tasks;
using YWM;
using YWM.Dto;

namespace PLC.Application.Variables
{
    public class VariableAppService : IVariableAppService
    {
        private readonly IVariableService _variableService = YApp.Resolve<IVariableService>();

        public async Task<PagedResultDto<VariableResultDto>> GetAll(VariableResultRequestDto input)
        {
            return await _variableService.GetCustomAll(input);
        }

        public Task<VariableResultDto> Save(VariableDto input)
        {
            return input.Id > 0 ? _variableService.Update(input) : _variableService.Create(input);
        }

        public Task Delete(EntityDto input)
        {
            return _variableService.Delete(input);
        }
    }
}
